package com.lili.order.controller.aftersale;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lili.common.result.Result;
import com.lili.model.order.entity.aftersale.AfterSaleReason;
import com.lili.order.service.aftersale.AfterSaleReasonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 *  用户信息管理
 */
@Api(tags = "售后原因管理")
@RestController
@RequestMapping("/admin/order/afterSaleReason")
public class AfterSaleReasonController {

    @Autowired
    private AfterSaleReasonService afterSaleReasonService;


    @ApiOperation("售后原因分页列表")
    @PostMapping("/queryByPage")
    public Result getByPage(@RequestBody Map map){
        Page<AfterSaleReason> page = afterSaleReasonService.queryByPage(map);
        return Result.ok(page);
    }
    @ApiOperation("添加售后原因")
    @PostMapping("/save")
    public Result save(@RequestBody AfterSaleReason afterSaleReason){
      int rs= afterSaleReasonService.save(afterSaleReason);
      return  rs==1?Result.ok():Result.fail();
    }
    @ApiOperation("删除售后原因")
    @DeleteMapping("/delete")
    public Result delete(String id){
        int rs= afterSaleReasonService.delete(id);
        return  rs==1?Result.ok():Result.fail();
    }
    @ApiOperation("修改售后原因")
    @PutMapping("/update")
    public  Result update(@RequestBody AfterSaleReason afterSaleReason){
        int rs= afterSaleReasonService.update(afterSaleReason);
        return  rs==1?Result.ok():Result.fail();
    }


}
